跳到主要内容

SetTextPr

Sets the text properties to the current Range.

Syntax

expression.SetTextPr(oTextPr);

expression - A variable that represents a ApiRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
oTextPrRequiredApiTextPrThe text properties that will be applied to the current range.

Returns

ApiRange | null

Example

This example sets the text properties to the Range.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("ONLYOFFICE Document Builder");
let textPr = paragraph.GetTextPr();
textPr.SetItalic(true);
let range = doc.GetRange(0, 24);
range.SetTextPr(textPr);